/* $Id : common.js www.mvmmall.com $ */
//发送一个请求
function makeRequest(url, functionName, httpType, sendData) {

	http_request = false;
	if (!httpType) httpType = "GET";

	if (window.XMLHttpRequest) { // Non-IE...
		http_request = new XMLHttpRequest();
		if (http_request.overrideMimeType) {
			http_request.overrideMimeType('text/plain');
		}
	} else if (window.ActiveXObject) { // IE
		try {
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
		}
	}

	if (!http_request) {
		alert('Cannot send an XMLHTTP request');
		return false;
	}

	var changefunc="http_request.onreadystatechange = "+functionName;
	eval (changefunc);
	http_request.open(httpType, url, true);
	http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	http_request.send(null);
}
//会员用户名检验
function Usercheck(mode)
{
    if (typeof(mode) == 'undefined'){
        return false;
    } else{
        var uData = encodeURIComponent(document.getElementById('' + mode + '').value);
        
        var gourl="ajax.php?action=user"+"&id="+uData+"&date="+Math.random();;
    }
    makeRequest(gourl,'check_member','GET')
    　
}
function check_member() {
	var show=document.getElementById('div_user');
	if (http_request.readyState == 1) {
	   show.innerHTML=user_msg['check']
	}
	if (http_request.readyState == 4) {
		if (http_request.status == 200) {
			show.innerHTML = http_request.responseText;
			savetime=-1000;
		}  else {
			alert(user_msg['error']);
		}
	}
}
//end

//层，打开，关闭
function toggle(targetid)
{
	var target=document.getElementById(targetid);
	target.style.display=(target.style.display=="block")?"none":"block";
	try
	{
		parent.loaded(document.body.scrollHeight);
	}
	catch(e)
	{
	}
}
//字母变大写
function pressCaptcha(obj)
{
    obj.value = obj.value.toUpperCase();
 }
 //字母变小写
function pressRegname(obj)
  {
    obj.value = obj.value.toLowerCase();
  }
 
  // popup移动脚本
function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';

  newWin= window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}
//打开窗口
function winopen(url,title,w,h) {
		newwin = window.open(url,title,"toolbar=0,location=0,status=0,menubar=0,scrollbars=yes,resizable=1,width=" + w + ",height=" + h + ",alwaysRadised=0");
		newwin.focus();
}

function HighlightAll(obj) {
	obj.focus();
	obj.select();
	if(document.all) {
		obj.createTextRange().execCommand("Copy");
		window.status = "将内容复制到剪贴板";
		setTimeout("window.status=''", 1800);
	}
}
